<?
$title = $_POST['title'];
$anons= str_replace("\'",'&prime;',str_replace('\"','&quot;',$_POST['anons']));
$text = str_replace("\'",'&prime;',str_replace('\"','&quot;',$_POST['text']));
$act = ($_POST['act'] == 'on')?true:false;
$_POST['date'] = date('Y-m-d',strtotime($_POST['date']));
//print_r($_POST['date']);
//preg_match_all('|^([0-9]+)/([0-9]+)/([0-9]+)$|Usi',$_POST['date'],$datematch);
//die($datematch[2][0].' '.$datematch[1][0].' '.$datematch[3][0]);
//$_POST['date'] = strtotime($datematch[3][0].' '.$datematch[1][0].' '.$datematch[2][0]);

//print_r($datematch); die();
//echo date('Y  M  d',$_POST['date']);
//print_r($_POST['date']); die();
$news = loadmodule('news');
$news = new news();
$news->add($title,$anons,$text,$_POST['date'],$act);
echo '{success: true}';
?>